/**
 * Copyright 2011 HNB. All rights reserved.
 * HNB PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package my.hnb.android.view.karaoke;

import java.util.ArrayList;

import my.hnb.android.adapter.SongAdapter;
import my.hnb.android.common.ActionEvent;
import my.hnb.android.common.AppInfo;
import my.hnb.android.common.ModelEvent;
import my.hnb.android.constant.Constants;
import my.hnb.android.constant.EventConstant;
import my.hnb.android.constant.IntentConstants;
import my.hnb.android.controller.UserController;
import my.hnb.android.dto.OptionItemDTO;
import my.hnb.android.dto.SongDTO;
import my.hnb.android.listenner.LoadingControlListener;
import my.hnb.android.listenner.OnEventListener;
import my.hnb.android.ultils.AppUltils;
import my.hnb.android.ultils.StringUtil;
import my.hnb.android.view.base.BaseActivity;
import my.hnb.android.view.control.EditTextClearable;
import my.hnb.android.view.control.LoadingControl;
import my.hnb.android.view.dialog.OptionDialog;
import my.hnb.songnhac.R;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Toast;

/**
 * Man hinh danh sach bai hat karaoke
 * 
 * @author BANGHN
 */
public class ListSongsView extends BaseActivity implements OnEventListener, OnItemClickListener, OnClickListener{
	public static final int ACTION_LOAD_MORE = 1;
	public static final int ACTION_CHANGE_SEARCH_OPTION = 2;
	public static final int ACTION_CHANGE_MUSIC_TYPE = 3;
	public static final int ACTION_CHANGE_VOL = 4;
	static int SONG_FOCUS = 1;
	static int FAVORITE_FOCUS = 2;
	int FOCUS = SONG_FOCUS;
	// du lieu karaoke
	ArrayList<SongDTO> dataListSong = new ArrayList<SongDTO>();
	//du lieu bai hat yeu thich
	ArrayList<SongDTO> dataListFavorite = new ArrayList<SongDTO>();
	//vi tri bai hat dang focus
	int songPosition = 0;
	// danh sach bai hat
	ListView lvSong;
	ListView lvSongFavorite;
	// editText search bai hat
	EditTextClearable edSearch;
	// adapter danh sach nhac
	SongAdapter songAdapter;
	SongAdapter favoriteAdapter;
	public LoadingControl loadingControl;
	// phan trang danh sach
	int pageSongs = 1;
	int pageFavorite = 1;
	boolean isSelectVol = false;
	boolean isSelectType = false;
	
	String textSearch = "";
	String textSearchTmp = "";
	
	//button the loai bai hat
	Button btSongType;
	Button btSongList;
	Button btSongLove;
	Button btSongVol;
	ImageView ivSearchOption;
	//dialog option
	OptionDialog dialogMusicType;
	OptionDialog dialogSearchOption;
	OptionDialog dialogVolOption;
	//xu ly thoat ung dung
	boolean doubleBackToExitPressedOnce = false;
	//bai hat dang chon
	int indexSelectSong = -1;
	
	@SuppressWarnings("unchecked")
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_karaoke_list);
		this.setTitleText(StringUtil.getString(R.string.app_title));
		lvSong = (ListView) findViewById(R.id.lvSongs);
		lvSongFavorite = (ListView) findViewById(R.id.lvSongFavorite);
		lvSong.setOnItemClickListener(this);
		lvSongFavorite.setOnItemClickListener(this);
		edSearch = (EditTextClearable) findViewById(R.id.edSearch);
		edSearch.addTextChangedListener(this.songSearchChangeListener);
		btSongType = (Button)findViewById(R.id.btSongType);
		btSongList = (Button)findViewById(R.id.btSongList);
		btSongLove = (Button)findViewById(R.id.btSongLove);
		btSongVol = (Button)findViewById(R.id.btSongVol);
		ivSearchOption = (ImageView)findViewById(R.id.ivSearchOption);
		
		btSongType.setOnClickListener(this);
		btSongList.setOnClickListener(this);
		btSongLove.setOnClickListener(this);
		btSongVol.setOnClickListener(this);
		ivSearchOption.setOnClickListener(this);
		ivMenu.setOnClickListener(this);
		
		//reset cac gia tri mac dinh
		new ResetData().execute();
		
		//defaul focus music
		btSongList.setBackgroundResource(R.drawable.icon_music_active);
		
		loadingControl = new LoadingControl(this, new LoadingControlListener() {
			@Override
			public void load() {
				if(FOCUS == SONG_FOCUS){
					pageSongs++;
					requesetGetSongs();
				}else{
					pageFavorite++;
					requesetGetSongsFavorite();
				}
			}
		});
		
		dataListSong = (ArrayList<SongDTO>) getIntent().getExtras().getSerializable(IntentConstants.INTENT_DATA);
		if(dataListSong != null){
			lvSong.removeFooterView(loadingControl);
			loadingControl.setLoadingState(LoadingControl.STATE_UN_AVAIABLE);
			if (dataListSong.size() == Constants.NUM_ITEM_PER_PAGE * pageSongs) {
				lvSong.addFooterView(loadingControl);
				loadingControl.setLoadingState(LoadingControl.STATE_AVAIABLE);
			}
			if (songAdapter == null) {
				songAdapter = new SongAdapter(this, dataListSong);
				lvSong.setAdapter(songAdapter);
			}else{
				songAdapter.notifyDataSetChanged();
			}
		}else{
			showProgressDialog("Đang tải bài hát...");
			requesetGetSongs();
		}
		
		
		lvSong.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				AppUltils.forceHideKeyboard(ListSongsView.this);
				return false;
			}
		});
	}
	
	//thuc hien reset cac gia tri mac dinh
	private class ResetData extends AsyncTask<Void, Void, Void>{
		@Override
		protected Void doInBackground(Void... arg0) {
			AppInfo.getInstance().resetMusicVolOption();
			AppInfo.getInstance().resetMusicTypeOption();
			return null;
		}
	}

	Handler searchHandler = new Handler();
	Runnable searchRunnable = new Runnable() {
		public void run() {
			if(FOCUS == SONG_FOCUS){
				pageSongs = 1;
				//dataListSong.clear();
				requesetGetSongs();
			}else{
				pageFavorite = 1;
				//dataListFavorite.clear();
				requesetGetSongsFavorite();
			}
		}
	};
	
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.layout_menu, menu);
		return true;
	}
	
	
	@Override
	public boolean onMenuItemSelected(int featureId, MenuItem item) {
		switch (item.getItemId()) {
		case R.id.menu_config:
			gotoSetting();
			break;
		case R.id.menu_about:
			//Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.songnhac.com.vn/"));
			//startActivity(browserIntent);
			gotoAbout();
			break;
		default:
			break;
		}
		return super.onMenuItemSelected(featureId, item);
	}
	
	
	private void gotoSetting() {
		Bundle b = new Bundle();
		ActionEvent e = new ActionEvent();
		e.sender = this;
		e.viewData = b;
		e.action = EventConstant.GOTO_SETTING;
		UserController.getInstance().handleSwitchActivity(e);
	}
	
	private void gotoAbout() {
		Bundle b = new Bundle();
		ActionEvent e = new ActionEvent();
		e.sender = this;
		e.viewData = b;
		e.action = EventConstant.GOTO_ABOUT;
		UserController.getInstance().handleSwitchActivity(e);
	}
	
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.ivMenu:{
			openOptionsMenu();
			break;
		}
		case R.id.btSongType:
			if (dialogMusicType == null) {
				dialogMusicType = new OptionDialog(this, "Thể loại", getResources().getDrawable(R.drawable.icon_music_folder));
				dialogMusicType.showDialog(AppInfo.getInstance().getMusicTypeOption(), ACTION_CHANGE_MUSIC_TYPE);
			} else if(!dialogMusicType.isShowing){
				dialogMusicType.showDialog(AppInfo.getInstance().getMusicTypeOption(), ACTION_CHANGE_MUSIC_TYPE);
			}

			break;
		case R.id.ivSearchOption:{
			if(dialogSearchOption == null){
				dialogSearchOption = new OptionDialog(this, "Tìm kiếm", getResources().getDrawable(R.drawable.icon_options));
				dialogSearchOption.showDialog(AppInfo.getInstance().getMusicSearchOption(), ACTION_CHANGE_SEARCH_OPTION);
			}else if(!dialogSearchOption.isShowing){
				dialogSearchOption.showDialog(AppInfo.getInstance().getMusicSearchOption(), ACTION_CHANGE_SEARCH_OPTION);
			}
			break;
		}
		case R.id.btSongVol:
			if(dialogVolOption == null){
				dialogVolOption = new OptionDialog(this, "Vol mới", getResources().getDrawable(R.drawable.icon_cd));
				dialogVolOption.showDialog(AppInfo.getInstance().getMusicVolOption(), ACTION_CHANGE_VOL);
			}else if(!dialogVolOption.isShowing){
				dialogVolOption.showDialog(AppInfo.getInstance().getMusicVolOption(), ACTION_CHANGE_VOL);
			}
			break;
		case R.id.btSongList:
			if(FOCUS == FAVORITE_FOCUS){
				FOCUS = SONG_FOCUS;
				lvSongFavorite.setVisibility(View.GONE);
				lvSong.setVisibility(View.VISIBLE);
				if(!textSearchTmp.equals(edSearch.getText().toString().trim())){
					pageSongs = 1;
					//dataListSong.clear();
					requesetGetSongs();
				}else{
					lvSong.removeFooterView(loadingControl);
					loadingControl.setLoadingState(LoadingControl.STATE_UN_AVAIABLE);
					if (dataListSong.size() == Constants.NUM_ITEM_PER_PAGE * pageSongs) {
						lvSong.addFooterView(loadingControl);
						loadingControl.setLoadingState(LoadingControl.STATE_AVAIABLE);
					}
				}
				btSongList.setBackgroundResource(R.drawable.icon_music_active);
				btSongLove.setBackgroundResource(R.drawable.icon_star_selector);
			}
			break;
		case R.id.btSongLove:
			if(FOCUS == SONG_FOCUS){
				lvSong.setVisibility(View.GONE);
				lvSongFavorite.setVisibility(View.VISIBLE);
				FOCUS = FAVORITE_FOCUS;
				//dataListFavorite.clear();
				requesetGetSongsFavorite();
				btSongList.setBackgroundResource(R.drawable.icon_music_selector);
				btSongLove.setBackgroundResource(R.drawable.icon_love_active);
				textSearchTmp = edSearch.getText().toString().trim();
			}
			break;
		default:
			break;
		}
	};

	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		indexSelectSong = arg2;
		if (FOCUS == SONG_FOCUS) {
			if (arg2 < dataListSong.size()) {
				gotoSongDetail(dataListSong.get(arg2));
			}
		} else {
			if (arg2 < dataListFavorite.size()) {
				gotoSongDetail(dataListFavorite.get(arg2));
			}
		}
	}
	
	

	/**
	 * Toi man hinh chi tiet bai hat
	 * @author BANGHN
	 */
	private void gotoSongDetail(SongDTO song) {
		Bundle b = new Bundle();
		b.putString(IntentConstants.INTENT_SONG_CODE, "" + song.songNumber);
		b.putSerializable(IntentConstants.INTENT_DATA, song);
		b.putInt(IntentConstants.INTENT_INDEX, indexSelectSong);
		ActionEvent e = new ActionEvent();
		e.sender = this;
		e.viewData = b;
		e.action = EventConstant.GOTO_LIST_SONG_DETAIL;
		UserController.getInstance().handleSwitchActivity(e);
	}

	/**
	 * Request lay danh sach bai nhac
	 * @author BANGHN
	 */
	private void requesetGetSongs() {
		setLoading(View.VISIBLE);
		textSearch = edSearch.getText().toString();
		ActionEvent e = new ActionEvent();
		Bundle b = new Bundle();
		b.putString(IntentConstants.INTENT_SONG_INFO, textSearch);
		b.putInt(IntentConstants.INTENT_PAGE_NUMBER, pageSongs);
		if(isSelectType || isSelectVol){
			b.putInt(IntentConstants.INTENT_SEARCH_OPTION, 1);
		}
		e.viewData = b;
		if(StringUtil.isNullOrEmpty(textSearch) && (isSelectType || isSelectVol)){
			e.action = EventConstant.GET_SONGS;
		}else{
			e.action = EventConstant.SEARCH_SONG;
		}
		e.sender = this;
		UserController.getInstance().handleViewEvent(e);
	}
	
	
	/**
	 * Request lay danh sach bai nhac
	 * @author BANGHN
	 */
	private void requesetGetSongsFavorite() {
		setLoading(View.VISIBLE);
		textSearch = edSearch.getText().toString();
		ActionEvent e = new ActionEvent();
		Bundle b = new Bundle();
		b.putString(IntentConstants.INTENT_SONG_INFO, textSearch);
		b.putInt(IntentConstants.INTENT_PAGE_NUMBER, pageFavorite);
		b.putInt(IntentConstants.INTENT_SONG_FAVORITE, 1);
		e.viewData = b;
		
		if(StringUtil.isNullOrEmpty(textSearch)){
			e.action = EventConstant.GET_SONGS_FAVORITE;
		}else{
			e.action = EventConstant.SEARCH_SONG_FAVORITE;
		}
		e.sender = this;
		UserController.getInstance().handleViewEvent(e);
	}
	
	
	

	@SuppressWarnings("unchecked")
	@Override
	public void handleModelViewEvent(ModelEvent modelEvent) {
		ActionEvent act = modelEvent.getActionEvent();
		switch (act.action) {
		case EventConstant.GET_SONGS: {
			if(pageSongs == 1)
				dataListSong.clear();
			ArrayList<SongDTO> model = (ArrayList<SongDTO>) modelEvent.getModelData();
			for (int i = 0; i < model.size(); i++) {
				SongDTO dto = model.get(i);
				dataListSong.add(dto);
			}
			lvSong.removeFooterView(loadingControl);
			loadingControl.setLoadingState(LoadingControl.STATE_UN_AVAIABLE);
			if (dataListSong.size() == Constants.NUM_ITEM_PER_PAGE * pageSongs) {
				lvSong.addFooterView(loadingControl);
				loadingControl.setLoadingState(LoadingControl.STATE_AVAIABLE);
			}
			
			//setLoading(View.GONE);
			if (songAdapter == null) {
				songAdapter = new SongAdapter(this, dataListSong);
				lvSong.setAdapter(songAdapter);
			}else{
				songAdapter.notifyDataSetChanged();
			}
			if(pageSongs == 1){
				lvSong.setSelection(0);
			}
			closeProgressDialog();
			break;
		}
		case EventConstant.SEARCH_SONG: {
			if(pageSongs == 1)
				dataListSong.clear();
			ArrayList<SongDTO> model = (ArrayList<SongDTO>) modelEvent.getModelData();
			for (int i = 0; i < model.size(); i++) {
				SongDTO dto = model.get(i);
				dataListSong.add(dto);
			}
			if(lvSong.getFooterViewsCount() > 0)
				lvSong.removeFooterView(loadingControl);
			loadingControl.setLoadingState(LoadingControl.STATE_UN_AVAIABLE);
			if (dataListSong.size() == Constants.NUM_ITEM_PER_PAGE * pageSongs) {
				lvSong.addFooterView(loadingControl);
				loadingControl.setLoadingState(LoadingControl.STATE_AVAIABLE);
			}
			//setLoading(View.GONE);
			if (songAdapter == null) {
				songAdapter = new SongAdapter(this, dataListSong);
				lvSong.setAdapter(songAdapter);
			}else{
				songAdapter.notifyDataSetChanged();
			}
			if(pageSongs == 1){
				lvSong.setSelection(0);
			}
			closeProgressDialog();
			break;
		}
		case EventConstant.GET_SONGS_FAVORITE: {
			if(pageFavorite == 1)
				dataListFavorite.clear();
			ArrayList<SongDTO> model = (ArrayList<SongDTO>) modelEvent.getModelData();
			for (int i = 0; i < model.size(); i++) {
				SongDTO dto = model.get(i);
				dataListFavorite.add(dto);
			}
			lvSongFavorite.removeFooterView(loadingControl);
			loadingControl.setLoadingState(LoadingControl.STATE_UN_AVAIABLE);
			if (dataListFavorite.size() == Constants.NUM_ITEM_PER_PAGE * pageFavorite) {
				lvSongFavorite.addFooterView(loadingControl);
				loadingControl.setLoadingState(LoadingControl.STATE_AVAIABLE);
			}
			setLoading(View.GONE);
			favoriteAdapter = new SongAdapter(this, dataListFavorite);
			lvSongFavorite.setAdapter(favoriteAdapter);
			if(pageFavorite == 1){
				lvSongFavorite.setSelection(0);
			}
			closeProgressDialog();
			break;
		}
		case EventConstant.SEARCH_SONG_FAVORITE: {
			if(pageFavorite == 1)
				dataListFavorite.clear();
			ArrayList<SongDTO> model = (ArrayList<SongDTO>) modelEvent.getModelData();
			for (int i = 0; i < model.size(); i++) {
				SongDTO dto = model.get(i);
				dataListFavorite.add(dto);
			}
			lvSongFavorite.removeFooterView(loadingControl);
			loadingControl.setLoadingState(LoadingControl.STATE_UN_AVAIABLE);
			if (dataListFavorite.size() == Constants.NUM_ITEM_PER_PAGE * pageFavorite) {
				lvSongFavorite.addFooterView(loadingControl);
				loadingControl.setLoadingState(LoadingControl.STATE_AVAIABLE);
			}
			setLoading(View.GONE);
			if (favoriteAdapter == null) {
				favoriteAdapter = new SongAdapter(this, dataListFavorite);
				lvSongFavorite.setAdapter(favoriteAdapter);
			}else{
				favoriteAdapter.notifyDataSetChanged();
			}
			if(pageFavorite == 1){
				lvSongFavorite.setSelection(0);
			}
			closeProgressDialog();
			break;
		}
		case EventConstant.UPDATE_FAVORITE:
			int position = (Integer) modelEvent.getActionEvent().userData;
			if (FOCUS == SONG_FOCUS) {
				dataListSong.get(position).favorite = 1 - dataListSong.get(position).favorite;
				songAdapter.notifyDataSetChanged();
			}else{
				dataListFavorite.get(position).favorite = 1 - dataListFavorite.get(position).favorite;
				favoriteAdapter.notifyDataSetChanged();
				for(int i = 0; i < dataListSong.size(); i++){
					if(dataListSong.get(i).songNumber == dataListFavorite.get(position).songNumber){
						dataListSong.get(i).favorite = dataListSong.get(position).favorite;
						songAdapter.notifyDataSetChanged();
						break;
					}
				}
				requesetGetSongsFavorite();
			}
			break;
		default:
			super.handleModelViewEvent(modelEvent);
			break;
		}
		setLoading(View.GONE);
	}

	@Override
	public void handleErrorModelViewEvent(ModelEvent modelEvent) {
		setLoading(View.GONE);
		loadingControl.setLoadingState(LoadingControl.STATE_AVAIABLE);
		super.handleErrorModelViewEvent(modelEvent);
	}

	@SuppressWarnings("unchecked")
	@Override
	public void onEvent(View v, int action, Object userData) {
		switch (action) {
		case ACTION_LOAD_MORE:
			//setLoading(View.VISIBLE);
			if(FOCUS == SONG_FOCUS){
				pageSongs++;
				requesetGetSongs();
			}else{
				pageFavorite++;
				requesetGetSongsFavorite();
			}
			break;
		case ACTION_CHANGE_SEARCH_OPTION:
			dialogSearchOption.dismiss();
			AppInfo.getInstance().setMusicSearhOption((ArrayList<OptionItemDTO>) userData);
			break;
		case ACTION_CHANGE_VOL:
			ArrayList<OptionItemDTO> tmp = (ArrayList<OptionItemDTO>) userData;
			boolean isChange = false;
			for(int i = 0; i < tmp.size(); i++){
				if(tmp.get(i).isSelected() != AppInfo.getInstance().getMusicVolOption().get(i).isSelected()){
					AppInfo.getInstance().setMusicVolOption((ArrayList<OptionItemDTO>) userData);
					isChange = true;
					break;
				}
			}
			if(isChange){
				if(AppInfo.getInstance().getMusicVolOption().get(0).isSelected()){
					isSelectVol = false;
				}else{
					isSelectVol = true;
				}
				if(FOCUS == SONG_FOCUS){
					pageSongs =1;
					//dataListSong.clear();
					requesetGetSongs();
				}
			}
			dialogVolOption.dismiss();
			break;
		case ACTION_CHANGE_MUSIC_TYPE:
			tmp = (ArrayList<OptionItemDTO>) userData;
			isChange = false;
			for(int i = 0; i < tmp.size(); i++){
				if(tmp.get(i).isSelected() != AppInfo.getInstance().getMusicTypeOption().get(i).isSelected()){
					AppInfo.getInstance().setMusicTypeOption((ArrayList<OptionItemDTO>) userData);
					isChange = true;
					break;
				}
			}
			if(isChange){
				if(AppInfo.getInstance().getMusicTypeOption().get(0).isSelected()){
					isSelectType = false;
				}else{
					isSelectType = true;
				}
				if(FOCUS == SONG_FOCUS){
					pageSongs =1;
					//dataListSong.clear();
					requesetGetSongs();
				}
			}
			dialogMusicType.dismiss();
			break;
		default:
			break;
		}
	}
	
	
	@Override
	public void receiveBroadcast(int action, Bundle bundle) {
		switch (action) {
		case EventConstant.NOTIFY_FAVORITE:
			try {
				int index = bundle.getInt(IntentConstants.INTENT_INDEX);
				int fav = bundle.getInt(IntentConstants.INTENT_SONG_FAVORITE);
				long code = bundle.getLong(IntentConstants.INTENT_SONG_CODE);
				if (FOCUS == SONG_FOCUS) {
					dataListSong.get(index).favorite = fav;
					songAdapter.notifyDataSetChanged();
				} else if (FOCUS == FAVORITE_FOCUS) {
					//dataListFavorite.get(index).favorite = fav;
					//favoriteAdapter.notifyDataSetChanged();
					//FOCUS = FAVORITE_FOCUS;
					pageFavorite = 1;
					//dataListFavorite.clear();
					requesetGetSongsFavorite();
					for(int i = 0; i < dataListSong.size(); i++){
						if(dataListSong.get(i).songNumber == code){
							dataListSong.get(i).favorite = fav;
							songAdapter.notifyDataSetChanged();
							break;
						}
					}
				}
				break;
			} catch (Exception e) {
				e.printStackTrace();
			}
		default:
			super.receiveBroadcast(action, bundle);
			break;
		}
	}
	
	
	@Override
	public void onBackPressed() {
		if (doubleBackToExitPressedOnce) {
			sendBroadcast(EventConstant.ACTION_FINISH_APP, new Bundle());
			super.onBackPressed();
			return;
		}
		this.doubleBackToExitPressedOnce = true;
		Toast.makeText(this, "Nhấn Back lần nữa để thoát ứng dụng!", Toast.LENGTH_SHORT).show();
		new Handler().postDelayed(new Runnable() {
			@Override
			public void run() {
				doubleBackToExitPressedOnce = false;
			}
		}, 2000);
	}

	
	/**
	 * Xu ly viec nhap text search
	 * @author BANGHN
	 */
	TextWatcher songSearchChangeListener = new TextWatcher() {
		public void afterTextChanged(Editable paramAnonymousEditable) {
			searchHandler.removeCallbacks(ListSongsView.this.searchRunnable);
			searchHandler.postDelayed(ListSongsView.this.searchRunnable, 300L);
		}

		public void beforeTextChanged(CharSequence paramAnonymousCharSequence, int paramAnonymousInt1,
				int paramAnonymousInt2, int paramAnonymousInt3) {
		}

		public void onTextChanged(CharSequence paramAnonymousCharSequence, int paramAnonymousInt1,
				int paramAnonymousInt2, int paramAnonymousInt3) {
			//MyLog.d("Search", "onTextChanged: " + paramAnonymousCharSequence);
		}
	};
	
}
